﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Driver;

namespace A2DFramework.BusinessExceptionService.Factories
{
    public static class MongoDBFactory
    {
        public static MongoCollection<BusinessExceptionWrapper> GetMongoDBCollection()
        {
            MongoClient client = new MongoClient("Servers=localhost:27017");
            MongoServer srv = client.GetServer();
            MongoDatabase db = srv.GetDatabase("Logs");
            if (!db.CollectionExists("BusinessExceptions"))
                db.CreateCollection("BusinessExceptions");

            MongoCollection<BusinessExceptionWrapper> collection = db.GetCollection<BusinessExceptionWrapper>("BusinessExceptions");

            return collection;
        }
    }
}
